package com.aod.benefit;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;

public class SplashActivity  extends Activity {

	// Splash screen timer
    private static int SPLASH_TIME_OUT = 500;
    private String pwdBenefit = "";
	
    @Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);

		SharedPreferences loginPreferences = getSharedPreferences(
				"Benefits", Context.MODE_PRIVATE);
					
		pwdBenefit = 
		loginPreferences.getString(
				"pwdBenefit",
				pwdBenefit);
		
        new Handler().postDelayed(new Runnable() {
 
            /*
             * Showing splash screen with a timer. This will be useful when you
             * want to show case your app logo / company
             */
 
            @Override
            public void run() {
                // This method will be executed once the timer is over
                // Start your app main activity
            	if(pwdBenefit.equals(""))
            	{
            		Intent i = new Intent(SplashActivity.this, MainActivity.class);
            		startActivity(i);
            	}
            	else
            	{
            		Intent i = new Intent(SplashActivity.this, SenhaActivity.class);
            		startActivity(i);
            	}
            	
                // close this activity
                finish();
            }
        }, SPLASH_TIME_OUT);
        
	}

}
